<?php
// +----------------------------------------------------------------------
// | 跃飞 [ 将来的你一定会感激现在奋斗的自己 ]
// +----------------------------------------------------------------------
// | Author: 钟贵廷
// +----------------------------------------------------------------------
// | Author URI: https://git.oschina.net/yeafy
// +----------------------------------------------------------------------
// | weChat:gt845272922  qq:845272922
// +----------------------------------------------------------------------


namespace app\yeafy\observer\demo2;


class Member implements IObserver
{
    private $subject;

    public function sendEmail($state)
    {
        if($state == 'pay')
        {
            echo '向会员发送支付成功的邮件';
        }
        elseif($state == 'add')
        {
            echo '向会员发送已经下单成功的邮件';
        }
        elseif($state == 'send')
        {
            echo '向会员发送已出货的邮件';
        }
    }


    public function observerOrder(ISubject $order)
    {
        $this->subject = $order;
        $this->subject ->registerObserver($this);
    }

}